/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

/* Container setup for iframe compatibility */
.container {
    width: 100%;
    height: 450px; /* Default iframe height */
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Adjust height for full browser view */
@media (min-height: 500px) {
    body:not(.iframe-mode) .container {
        height: 90vh;
        max-height: 800px;
    }
}

/* Header information panel - new addition at top */
.header-info {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    border-left: 4px solid #667eea;
}

.header-info h2 {
    color: #333;
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 600;
}

.header-ranges {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.range-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.range-label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.range-item span:last-child {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 120px;
}

/* NEW: EM Wave Selection Panel Styles */
.em-wave-panel {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.em-wave-panel h3 {
    color: #333;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: center;
}

.wave-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.wave-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    color: #495057;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.wave-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.wave-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.wave-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Specific colors for each wave type button */
.wave-btn[data-wave="radio"] {
    border-color: #8B4513;
}
.wave-btn[data-wave="radio"].active {
    background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
    border-color: #8B4513;
}

.wave-btn[data-wave="microwave"] {
    border-color: #CD853F;
}
.wave-btn[data-wave="microwave"].active {
    background: linear-gradient(135deg, #CD853F 0%, #DEB887 100%);
    border-color: #CD853F;
}

.wave-btn[data-wave="infrared"] {
    border-color: #FF4500;
}
.wave-btn[data-wave="infrared"].active {
    background: linear-gradient(135deg, #FF4500 0%, #FF6347 100%);
    border-color: #FF4500;
}

.wave-btn[data-wave="visible"] {
    border-color: #00FF00;
}
.wave-btn[data-wave="visible"].active {
    background: linear-gradient(to right, #8B00FF, #4B0082, #0000FF, #00FF00, #FFFF00, #FFA500, #FF0000);
    border-color: #00FF00;
}

.wave-btn[data-wave="ultraviolet"] {
    border-color: #9370DB;
}
.wave-btn[data-wave="ultraviolet"].active {
    background: linear-gradient(135deg, #9370DB 0%, #BA55D3 100%);
    border-color: #9370DB;
}

.wave-btn[data-wave="xray"] {
    border-color: #4169E1;
}
.wave-btn[data-wave="xray"].active {
    background: linear-gradient(135deg, #4169E1 0%, #6495ED 100%);
    border-color: #4169E1;
}

.wave-btn[data-wave="gamma"] {
    border-color: #191970;
}
.wave-btn[data-wave="gamma"].active {
    background: linear-gradient(135deg, #191970 0%, #483D8B 100%);
    border-color: #191970;
}

/* Controls container */
.controls-container {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.control-panel {
    flex: 1;
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.control-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.control-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.tooltip {
    cursor: help;
    color: #666;
    font-size: 12px;
}

/* Slider styles with electromagnetic spectrum colors - Modified to add color gradients */
.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 8px;
    position: relative;
    /* Added electromagnetic spectrum gradient background */
    background: linear-gradient(to right, 
        #191970 0%,     /* Gamma rays */
        #4169E1 14.3%,  /* X-rays */
        #9370DB 28.6%,  /* Ultraviolet */
        #8B00FF 35%,    /* Violet */
        #4B0082 40%,    /* Indigo */
        #0000FF 45%,    /* Blue */
        #00FF00 50%,    /* Green */
        #FFFF00 55%,    /* Yellow */
        #FFA500 60%,    /* Orange */
        #FF0000 65%,    /* Red */
        #FF4500 71.4%,  /* Infrared */
        #CD853F 85.7%,  /* Microwaves */
        #8B4513 100%    /* Radio waves */
    );
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 3px solid #333;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: 3px solid #333;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Firefox slider track styling */
.slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, 
        #191970 0%,     /* Gamma rays */
        #4169E1 14.3%,  /* X-rays */
        #9370DB 28.6%,  /* Ultraviolet */
        #8B00FF 35%,    /* Violet */
        #4B0082 40%,    /* Indigo */
        #0000FF 45%,    /* Blue */
        #00FF00 50%,    /* Green */
        #FFFF00 55%,    /* Yellow */
        #FFA500 60%,    /* Orange */
        #FF0000 65%,    /* Red */
        #FF4500 71.4%,  /* Infrared */
        #CD853F 85.7%,  /* Microwaves */
        #8B4513 100%    /* Radio waves */
    );
    border: none;
}

.value-display {
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    text-align: center;
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Information panel - modified to remove wave info section */
.info-panel {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.applications h4 {
    color: #333;
    font-size: 14px;
    margin-bottom: 8px;
    border-bottom: 2px solid #667eea;
    padding-bottom: 4px;
}

.app-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-item {
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    color: #555;
    border-left: 3px solid #667eea;
    transition: all 0.2s ease;
}

.app-item:hover {
    background: #e9ecef;
    transform: translateX(2px);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .container {
        padding: 8px;
        gap: 6px;
    }
    
    .header-ranges {
        flex-direction: column;
        gap: 8px;
    }
    
    .range-item {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .controls-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .control-panel {
        padding: 10px;
    }
    
    .slider::-webkit-slider-thumb {
        width: 26px;
        height: 26px;
    }
    
    .info-panel {
        padding: 10px;
    }
    
    /* Mobile adjustments for wave buttons */
    .wave-buttons {
        gap: 4px;
    }
    
    .wave-btn {
        font-size: 10px;
        padding: 6px 8px;
        min-width: 70px;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid #000;
    }
    
    .control-panel, .info-panel, .header-info, .em-wave-panel {
        border: 1px solid #000;
    }
}